home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 January / Macworld (1997-01).dmg / Games World / Shareware Games / Arcade / Mike's Breakout / Mike'sproject.p < prev    next >
Text File  |  1996-07-07  |  3KB  |  130 lines

  1. {send all comments/gripes/etc to ani@atlas.nmsu.edu}
  2. {feel free to use this code for whatever you'd like.  i'd be grateful i helped make someone's day just a bit brighter}
  3. {please note that this file pretty much has no function in the game at all, and was originally used as just a test.}
  4. {however, it does do standard toolbox init, which has to be done somewhere}
  5. program Mike;
  6.     uses
  7.         TypeConst, MTSound, MTGW, Graphics, Game;
  8.     const
  9.         delay = 5000;
  10.         start = 900;
  11.         num = 12;
  12.     var
  13.         x: ciconhandle;
  14.         l: array[0..30] of ciconhandle;
  15.         r: rect;
  16.         q: longint;
  17.         a, b, i, j: integer;
  18.  
  19.         fred: oserr;
  20.         buffer: ptr;
  21.         offset: longint;
  22.         theqcmd, thecmd: sndcommand;                            {only need 1... can recycle                                                        }
  23.         thesnd: handle;
  24. begin
  25.     maxapplzone;
  26.     moremasters;
  27.     initgraf(@theport);
  28.     initfonts;
  29.     initwindows;
  30.     initmenus;
  31.     teinit;
  32.     initdialogs(nil);
  33.     flushevents(everyevent, 0);
  34.     initcursor;
  35.  
  36.     initsound;
  37.     initgraphics;
  38.     initgame;
  39. {init the stuff then just jump into the game code}
  40.     killsound;
  41.     ExitToShell;
  42. {ANYTHING BELOW HERE IS JUST FOR TESTING}
  43.     SetSoundVol(1);
  44.     fred := sndnewchannel(thechan, sampledsynth, 0, nil);
  45.     thesnd := GetResource('snd ', 200);
  46.     fred := MTGetSoundHeaderOffset(thesnd, offset);
  47.     hlock(thesnd);
  48.     with thecmd do
  49.         begin
  50.             cmd := buffercmd;
  51.             param1 := 0;
  52.             param2 := longint(ord4(thesnd^) + offset);
  53.         end;
  54.     with theqcmd do
  55.         begin
  56.             cmd := quietcmd;
  57.         end;
  58. {fred := snddoimmediate(thechan, thecmd);}
  59.     showdrawing;
  60.     for i := 0 to num do
  61.         begin
  62.             l[i] := CIcons[start + i];
  63.         end;
  64. {    l[9] := getcicon(300);}
  65.     while not button do
  66.         begin
  67.             fred := snddoimmediate(thechan, theqcmd);
  68.             fred := snddoimmediate(thechan, thecmd);
  69.             a := (abs(random) mod 10) + 100;
  70.             b := (abs(random) mod 10) + 100;
  71.             for i := 0 to num do
  72.                 begin
  73.                     x := l[i];
  74.                     r := x^^.iconpmap.bounds;
  75. {offsetrect(r, a, b);}
  76.                     q := tickcount + 1;
  77.                     while tickcount <> q do
  78.                         ;
  79.                     plotcicon(r, x);
  80.                     for j := 0 to delay do
  81.                         ;
  82.                     EraseRect(r);
  83.                     a := a + 10;
  84.                     b := b + 10;
  85.                     if false then
  86.                         begin
  87.                             if (i = 0) or (i = 4) then
  88.                                 for j := 0 to delay do
  89.                                     ;
  90.                         end; {coment}
  91.                 end;
  92.             EraseRect(r);
  93.  
  94.             begin
  95.                 if false then
  96.                     begin
  97.                         begin
  98.                             for j := 0 to delay do
  99.                                 ;
  100.                             for i := 0 to num do
  101.                                 begin
  102.                                     x := l[3];
  103.                                     r := x^^.iconpmap.bounds;
  104.                                     offsetrect(r, 50, 50);
  105.                                     insetrect(r, i * (-5), i * (-5));
  106.                                     q := tickcount + 1;
  107.                                     while tickcount <> q do
  108.                                         ;
  109.                                     EraseRect(r);
  110.                                     plotcicon(r, x);
  111.                                     EraseRect(r);
  112.                                     for j := 0 to delay do
  113.                                         ;
  114.                                 end;
  115.                         end;
  116.                     end;
  117.             end;
  118.         end;
  119.     with thecmd do
  120.         begin
  121.             cmd := flushcmd;
  122.         end;
  123.     fred := snddoimmediate(thechan, thecmd);
  124.     fred := snddisposechannel(thechan, true);
  125.     disposeptr(ptr(thechan));
  126.     hunlock(thesnd);                                                {it's lying on the ground... make sure    }
  127.     releaseresource(thesnd);
  128.  
  129.  
  130. end.